<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <meta HTTP-EQUIV="pragma" CONTENT="no-cache"> 
    <title>品正全球购</title>
    <!-- page specific plugin styles -->
    <link rel="stylesheet" href="{$Think.const.STATIC_DOMAIN}/static/ace/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="{$Think.const.STATIC_DOMAIN}/static/weui-extension/dist/style/weui-extension.min.css" />
    <link href="{$Think.const.STATIC_DOMAIN}/static/jquery-weui/dist/css/jquery-weui.min.css" rel="stylesheet">
    <!-- inline styles related to this page -->
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/app.css?v={$Think.const.STATIC_VERSION}">
    {block name="inline-styles"}{/block}
    <!-- 
    <script src="{$Think.const.STATIC_DOMAIN}/static/vConsole/dist/vconsole.min.js"></script>
    <script type="text/javascript">
        // init vConsole
        var vConsole = new VConsole();
        console.log('Hello world');
    </script> 
    -->
</head>
<body ontouchstart>
	<div class="container" id="container">
		{block name="content"}{/block}
	</div>
	<!-- page specific plugin scripts -->
	<script src="{$Think.const.STATIC_DOMAIN}/static/plugin/jquery-1.11.3.min.js"></script>
	<script src="{$Think.const.STATIC_DOMAIN}/static/jquery-weui/dist/js/jquery-weui.min.js"></script>
    <script src="{$Think.const.STATIC_DOMAIN}/static/plugin/jquery.form.js"></script>
	<!-- inline scripts related to this page -->
    <script type="text/javascript">
        // 获得链接中参数
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        //表单回显
        function initFormHTML(id, json) {
            var data = $("#" + id + " *[name]");
            data.each(function() {
                var value = json[$(this).attr("name")];
                if (value != null) {
                    var type = $(this).attr("type");
                    if (type == "checkbox" || type == "radio") {
                        if (type == "checkbox") {
                            // var valueArray = value.split(",");
                            for (var i = 0; i < value.length; i++) {
                                if ($(this).val() == value[i])
                                    $(this).attr("checked", "checked");
                            }
                        } else if (type == "radio") {
                            if ($(this).val() == value) {
                                $(this).attr("checked", "checked");
                            }
                        }

                    } else {
                        $(this).val(value);
                    }
                }
            });
        }
        //详情回显
        function initPageHTML(id, json) {
            var data = $("#" + id + " *[id]");
            data.each(function() {
                var value = json[$(this).attr("id")];
                if (value != null) {
                    $(this).html(value);
                }
            });
        }

        // 重置返回键
        function pushHistory() { 
            var state = { 
                title: "品正全球购", 
                url: window.location.href
            }; 
            window.history.pushState(state, state.title, state.url); 
        }


        // 重置浏览器回退链接
        function browserBack(_href) {
            /**
             * 浏览器回退事件监听
             */
            var listenerBackHandler = {
                param: {
                    isRun: false, //防止微信返回立即执行popstate事件
                },
                listenerBack: function () {
                    var state = {
                        title: "title",
                        url: "#"
                    };
                    window.history.pushState(state, "title", "#");
             
                    window.addEventListener("popstate", function (e) {
                        if (listenerBackHandler.param.isRun) {
                            window.location.href = _href; //返回到指定链接
                        }
                    }, false);
                },
                //初始化返回事件
                initBack: function () {
                    window.addEventListener('pageshow', function () {
                        listenerBackHandler.param.isRun = false;
                        setTimeout(function () { listenerBackHandler.param.isRun = true; }, 1000); //延迟1秒 防止微信返回立即执行popstate事件
                        listenerBackHandler.listenerBack();
                    });
                }
            }
            listenerBackHandler.initBack();
        }
    </script>
	{block name="related-scripts"}{/block}
</body>
</html>